/* ============ CSS 变量 ============ */

:root {
    --loading-color: var(--primary-color, #0066cc);
}

/* ============ 加载动画容器 ============ */

.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.loading-small {
    width: 40px;
    height: 40px;
}

.loading-medium {
    width: 60px;
    height: 60px;
}

.loading-large {
    width: 80px;
    height: 80px;
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* ============ 全屏加载 ============ */

.loading-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============ Spinner 动画 ============ */

.loading-spinner {
    position: relative;
    width: 100%;
    height: 100%;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--loading-color);
    border-radius: 50%;
    animation: spinner-rotate 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
}

.spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
}

@keyframes spinner-rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ============ Dots 动画 ============ */

.loading-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
}

.loading-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--loading-color);
    animation: dots-bounce 1.4s infinite ease-in-out both;
}

.loading-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dots-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============ Bars 动画 ============ */

.loading-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
}

.loading-bars .bar {
    width: 4px;
    height: 30%;
    background: var(--loading-color);
    border-radius: 2px;
    animation: bars-scale 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
}

.loading-bars .bar:nth-child(1) {
    animation-delay: -0.24s;
}

.loading-bars .bar:nth-child(2) {
    animation-delay: -0.12s;
}

@keyframes bars-scale {
    0%, 100% {
        transform: scaleY(0.4);
    }
    50% {
        transform: scaleY(1);
    }
}

/* ============ Circle 动画 ============ */

.loading-circle {
    width: 100%;
    height: 100%;
}

.loading-circle svg {
    width: 100%;
    height: 100%;
    animation: circle-rotate 2s linear infinite;
}

.circle-path {
    stroke: var(--loading-color);
    stroke-dasharray: 125.6;
    stroke-dashoffset: 0;
    animation: circle-dash 1.5s ease-in-out infinite;
}

@keyframes circle-rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes circle-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -125;
    }
}

/* ============ Wave 动画 ============ */

.loading-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 100%;
}

.loading-wave .wave {
    width: 4px;
    height: 20px;
    background: var(--loading-color);
    border-radius: 2px;
    animation: wave-motion 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
}

.loading-wave .wave:nth-child(1) {
    animation-delay: -0.24s;
}

.loading-wave .wave:nth-child(2) {
    animation-delay: -0.12s;
}

@keyframes wave-motion {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ============ 响应式 ============ */

@media (max-width: 768px) {
    .loading-small {
        width: 32px;
        height: 32px;
    }

    .loading-medium {
        width: 48px;
        height: 48px;
    }

    .loading-large {
        width: 64px;
        height: 64px;
    }

    .loading-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .loading-wrapper {
        gap: 8px;
    }

    .loading-small {
        width: 28px;
        height: 28px;
    }

    .loading-medium {
        width: 40px;
        height: 40px;
    }

    .loading-large {
        width: 56px;
        height: 56px;
    }
}
